#include "../StdInc.h"

namespace GSTrader
{
	namespace TradeBase
	{
		CBroker::CBroker() : m_nPlatformType(0), m_strBrokerID(""), m_strBrokerName("")
		{
		}


		CBroker::~CBroker()
		{
		}

		CBroker::CBroker(const CBroker& r)
		{
			*this = r;
		}

		CBroker& CBroker::operator = (const CBroker& r)
		{
			m_nPlatformType = r.m_nPlatformType;
			m_strBrokerID = r.m_strBrokerID;
			m_strBrokerName = r.m_strBrokerName;
			m_vTradeFront.resize(r.m_vTradeFront.size());
			copy(r.m_vTradeFront.begin(), r.m_vTradeFront.end(), m_vTradeFront.begin());
			m_vQuoteFront.resize(r.m_vQuoteFront.size());
			copy(r.m_vQuoteFront.begin(), r.m_vQuoteFront.end(), m_vQuoteFront.begin());

			return *this;
		}

		bool CBroker::operator == (const CBroker& r)
		{
			return m_nPlatformType == r.m_nPlatformType && m_strBrokerID == r.m_strBrokerID;
		}

		void CBroker::AddTradeFront(string strUrl)
		{
			m_vTradeFront.push_back(strUrl);
		}

		void CBroker::AddQuoteFront(string strUrl)
		{
			m_vQuoteFront.push_back(strUrl);
		}

		void CBroker::Reset()
		{
			m_nPlatformType = 0;
			m_strBrokerID = "";
			m_strBrokerName = "";

			m_vTradeFront.clear();
			m_vQuoteFront.clear();
		}
	}
}